package com.kingyun.gpsinspection.purificationservice.services.jsm.outerservice.impl;

import com.kingyun.gpsinspection.purificationservice.dao.mapper.jsm.JsmEntityMapper;
import com.kingyun.gpsinspection.purificationservice.facade.model.jsm.Employee;
import com.kingyun.gpsinspection.purificationservice.facade.model.jsm.EntityPro;
import com.kingyun.gpsinspection.purificationservice.facade.model.jsm.EntityVo;
import com.kingyun.gpsinspection.purificationservice.facade.model.jsm.Ztree;
import com.kingyun.gpsinspection.purificationservice.facade.service.jsm.OutEntityService;
import com.kingyun.gpsinspection.purificationservice.facade.service.jsm.entity.JsmEntityService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * Created by YuPeng on 2016/12/15.
 * modify by HuangXueQian on 2017/03/17
 */

public class OutEntityServiceImpl implements OutEntityService {
    @Autowired
    private JsmEntityService entityService;
    @Autowired
    private JsmEntityMapper jsmEntityMapper;

    /**
     * @param isOrg
     * @param id
     * @return
     * @throws Exception
     */
    @Override
    public List<Ztree> getEntityTree(String isOrg, String id,Employee employee) throws Exception {
        List<Ztree> list = entityService.getEntityTree(isOrg, id,employee);
        return list;
    }

    /**
     * 获取实体信息
     *
     * @param enId 实体Id
     * @return
     */
    @Override
    public EntityVo getEntityByEntityId(String enId) throws Exception {
        return jsmEntityMapper.selectByEnId(enId);
    }

    /**
     * 获取某个生产实体的特性值
     *
     * @param enId
     * @return
     */
    @Override
    public List<EntityPro> getFeaturesByEntityId(String enId) {
        return entityService.getEntityProByEntityId(enId);
    }

    /**
     * @param employee 人员信息 ；  根据人员信息
     * 获取当前人员的组织，
     * 根据当前人员组织 获取实体
     * @param isOrg
     * @param keyword
     * @orgId 组织机构ID
     */
    @Override
    public List<Ztree> getEntityByEmployee(Employee employee, String isOrg, String orgId, String keyword) throws Exception {
        return entityService.getEntityZtreeByEmployee(employee, isOrg, orgId, keyword);
    }

}
